#define _CRT_SECURE_NO_WARNINGS 1



#include<stdio.h>


int main()
{
	int n = 0, a = 0, b = 0;
	while (scanf("%d", &n) != EOF)
	{
		if (n == 0)
			a++;
		else
			b++;
		if (a > 21 || b > 21)
			break;
	}
	if (a > b)
		printf("0\n");
	else
		printf("1\n");

	return 0;
}